/*
*	made by WeiNing.Wang 2011-04-12
*/

(function($) {

    $.fn.OpenDiv = function(o) {

        var settings = {

            Dwindow: "",

            framsetranse: "",

            Dwidth: "",

            Dheight: "",

            Dlocation: "",

            Dtithtml: "",

            Dreload: false
        };

     
        var set = $.extend({}, settings, o || {});

    
        init(this);

        function init(o) {
            var self = $(o);




            $(set.Dwindow.document).find("body").append("<div class='Scover'><iframe width='100%' height='100%' frameborder='0' src=" + set.framsetranse + " class='ScoverIframe' ></iframe></div>");

                
                $(set.Dwindow.document).find("body").append("<div class='dragDiv' id='dragDiv'></div>");
            

                $(".dragDiv", $(set.Dwindow.document)).css({ "width": set.Dwidth + "px", "height": set.Dheight + "px", "margin-left": -parseInt(set.Dwidth / 2) + "px", "margin-top": -parseInt(set.Dheight / 2) + "px" });

                $(".dragDiv", $(set.Dwindow.document)).html("<div class='dragDivtit' id='dragDivtit'><div class='dragDivtitL'>" + set.Dtithtml + "</div><div class='dragDivtitR'><a href='javascript:void(0)'></a></div></div><div class='dragDivCon'><iframe width='100%' height='100%' frameborder='0' scrolling='auto'  src=" + set.Dlocation + " class='dragDivIframe'></iframe></div>");

                $(".dragDivCon", $(set.Dwindow.document)).css({ "height": parseInt(set.Dheight - 50) + "px", "width": parseInt(set.Dwidth - 20) + "px",  "margin": "10px 10px 10px 10px" });

                $("a", $(set.Dwindow.document).find("div.dragDivtitR")).bind("click", closeOpenDiv);

                var drag = new window.parent.Drag("dragDiv", { mxContainer: "moveOpenDiv", Handle: "loginBoxt", Limit: true, onStart: function () { }, onMove: function () { }, onStop: function () { }
                });
            
        }



        function closeOpenDiv() {
        
            $(set.Dwindow.document).find(".ScoverIframe").attr("src","")
            $(set.Dwindow.document).find("div.Scover").remove();
            $(set.Dwindow.document).find(".dragDivIframe").attr("src","")
            $(set.Dwindow.document).find("div.dragDiv").remove();

            if (set.Dreload) window.location.reload();
        }

    }

})(jQuery);
 
 

 

 
 
 